package com.jfz.quick.core.db.demo;

import com.jfz.quick.core.db.DBHelper;
import com.jfz.quick.core.db.LightIgnore;
import com.jfz.quick.core.db.LightOrmHelper;
import com.jfz.quick.core.db.LightPrimaryKey;
import com.jfz.quick.core.db.LightTableName;
import com.jfz.quick.core.db.WhereBulider;

public class LightOrmTest {
    private void test() {
        try {
            LightOrmHelper.initSdk();
        } catch (Exception e) {
            e.printStackTrace();
        }
        LightOrmHelper.getInstent().initSQLiteOpenHelper(new DBHelper(null, true));//设置数据库相关信息 不设置则默认
        TestDb bean = new TestDb();//测试对象
        LightOrmHelper.getInstent().save(bean);
        LightOrmHelper.getInstent().updata(bean);
        LightOrmHelper.getInstent().remove(bean);//删除当前数据
        LightOrmHelper.getInstent().remove(TestDb.class);//删除表
        LightOrmHelper.getInstent().query(TestDb.class, WhereBulider.creat().where("age<", "10").limit(1, 10));
    }

    @LightTableName("TestTable")
    private class TestDb {
        @LightPrimaryKey
        int age;
        @LightIgnore
        String test;
    }
}
